Property Get SelectedFiles(lIndex As Long) As String
If lIndex < 0 Or lIndex >= lSelectedFiles Then
SelectedFiles = ""
Else
SelectedFiles = saSelectedFiles(lIndex)
End If
End Property
Public Sub AddSelectedFiles(sFile As String)
If lSelectedFiles <= UBound(saSelectedFiles) Then
saSelectedFiles(lSelectedFiles) = sFile
lSelectedFiles = lSelectedFiles + 1
End If
End Sub
Property Let MaxSelectedFiles(lSize As Long)
If lSize > 0 Then
ReDim saSelectedFiles(0 To lSize - 1)
End If
lSelectedFiles = 0
End Property
Property Get SelectedFilesCount() As Long
SelectedFilesCount = lSelectedFiles
End Property
Property Get SelectedKeys(lIndex As Long) As String
If lIndex < 0 Or lIndex >= lSelectedKeys Then
SelectedKeys = ""
Else
SelectedKeys = saSelectedKeys(lIndex)
End If
End Property
Public Sub AddSelectedKeys(sKey As String)
If lSelectedKeys <= UBound(saSelectedKeys) Then
saSelectedKeys(lSelectedKeys) = sKey
lSelectedKeys = lSelectedKeys + 1
End If
End Sub
Property Let MaxSelectedKeys(lSize As Long)
If lSize > 0 Then
ReDim saSelectedKeys(0 To lSize - 1)
End If
lSelectedKeys = 0
End Property
Property Get SelectedKeysCount() As Long
SelectedKeysCount = lSelectedKeys
End Property
'
' Methods
'
Private Sub Class_Initialize()
'Intialize all the objects that will be used
Set xMain = New XceedBackup
Set xRestore = New RestoreJob
Set xSelection = New FileSelection
Set xStatus = New frmStatus
Set xMessage = New frmMessage
ReplaceAll = vbCancel
lSelectedFiles = 0
lSelectedKeys = 0
End Sub
Private Sub Class_Terminate()
'Release all the objects
Set xMain = Nothing
Set xRestore = Nothing
Set xSelection = Nothing
Unload xStatus
Set xStatus = Nothing
Unload xMessage
Set xMessage = Nothing
Unload frmHidden
End Sub
Private Sub xMain_BeforeRestoringFile(ByVal sFilename As String, ByVal lSize As Long, ByVal xAttributes As XceedBackupLib.bkpFileAttributes, ByVal dtLastModified As Date, ByVal dtLastAccessed As Date, ByVal dtCreated As Date, ByVal lDiskNumber As Long)
Private Sub xMain_FileStatus(ByVal sFilename As String, ByVal lSize As Long, ByVal lBytesProcessed As Long, ByVal nPercentCompleted As Integer)
xStatus.lblFileName.Caption = sFilename
xStatus.ItemPercent = nPercentCompleted
End Sub
Private Sub xMain_GlobalStatus(ByVal lFilesTotal As Long, ByVal lFilesProcessed As Long, ByVal lFilesSkipped As Long, ByVal nFilesPercent As Integer, ByVal lBytesTotal As Long, ByVal lBytesProcessed As Long, ByVal lBytesSkipped As Long, ByVal nBytesPercent As Integer)
If xMain.CurrentOperation = bcoRecreateCatalogs Then
frmTwo.Percent = nFilesPercent
Else
xStatus.TotalPercent = nBytesPercent
xStatus.lblPercent.Caption = nBytesPercent & "%"
End If
End Sub
Private Sub xMain_InsertMedia(ByVal sMediaLabel As String, ByVal lDiskNumber As Long, bMediaInserted As Boolean)
Dim Answer As VbMsgBoxResult
Answer = MsgBox("Please insert disk number " & Trim(Str(lDiskNumber)) & " of the media labeled """ & sMediaLabel & """", _
vbOKCancel + vbInformation)
If Answer = vbOK Then
bMediaInserted = True
End If
End Sub
Public Function RecreateCatalogs() As Boolean
Dim ResultCode As bkpError
Dim Answer As VbMsgBoxResult
'Confirm if the catalogs are to be recreated
Answer = MsgBox("You are about to recreate the catalogs. Do you want to continue?", _
vbYesNo + vbQuestion)
'If cancel is pressed then the backups are not recreated
MsgBox "Catalogs have been successfully recreated.", vbOKOnly + vbExclamation
RecreateCatalogs = True
Else
MsgBox "Could not recreate the catalogs. Error code " & Trim(Str(ResultCode)) & " (" & xMain.GetErrorDescription(bvtError, ResultCode) & ")", _
vbOKOnly + vbCritical
End If
End If
End Function
Private Sub xMain_InvalidPassword(ByVal sBackupFilename As String, sPassword As String, bPasswordProvided As Boolean)
'Triggered if an invalid password was given
sPassword = InputBox("The password you have provided for the backup set " & sBackupFilename & " is invalid. Please enter a new one.", "Recovery Wizard")
'If cancel is pressed, the input box returns an empty string.
'If a valid password is entered then set bPasswordProvided to True
'If an invalid password is provided, it will again trigger the
'InvalidPassword event
If sPassword = "" Then
bPasswordProvided = False
Else
bPasswordProvided = True
End If
End Sub
Private Sub xMain_ProcessCompleted(ByVal lFilesTotal As Long, ByVal lFilesProcessed As Long, ByVal lFilesSkipped As Long, ByVal lBytesTotal As Long, ByVal lBytesProcessed As Long, ByVal lBytesSkipped As Long, ByVal xResult As XceedBackupLib.bkpError)
Private Sub xMain_ReplacingFile(ByVal sFilename As String, ByVal lExistingSize As Long, ByVal xExistingAttributes As XceedBackupLib.bkpFileAttributes, ByVal dtExistingLastModified As Date, ByVal dtExistingLastAccessed As Date, ByVal dtExistingCreated As Date, ByVal lSize As Long, ByVal xAttributes As XceedBackupLib.bkpFileAttributes, ByVal dtLastModified As Date, ByVal dtLastAccessed As Date, ByVal dtCreated As Date, ByVal lDiskNumber As Long, bSkipFile As Boolean)
Dim Answer As VbMsgBoxResult
'ReplaceAll is used to avoid asking for each file to replace
If ReplaceAll = vbCancel Then
ReplaceAll = MsgBox("At least one file being restored already exists. Do you want to replace all the files?", _
vbYesNo + vbQuestion)
End If
If ReplaceAll = vbYes Then
bSkipFile = False
Else
Answer = MsgBox("Do you wish to replace " & sFilename & " ?", vbYesNo + vbQuestion)
If Answer = vbYes Then
bSkipFile = False
End If
End If
End Sub
Private Sub xMain_ReplacingRegKey(ByVal sRegKey As String, xAction As XceedBackupLib.bkpReplacingRegKeyAction)
Dim xActionMessage As enuActionMessage
xMessage.lblRegKey = sRegKey
'ShowForm from frmMessage returns enuActionMessage which will determine wether
'the Registry keys will be Skipped, Merged or Overwritten. And if it is applied to all
xActionMessage = xMessage.ShowForm
If xActionMessage <> maAbort Then
xAction = xActionMessage
Else
xMain.Abort = True
End If
End Sub
Private Sub xMain_RestoringRegKey(ByVal sRegKey As String)
xMessage.lblRegKey.Caption = sRegKey
End Sub
Private Sub xMain_SkippingFile(ByVal sFilename As String, ByVal lSize As Long, ByVal xAttributes As XceedBackupLib.bkpFileAttributes, ByVal dtLastModified As Date, ByVal dtLastAccessed As Date, ByVal dtCreated As Date, ByVal xSkippingReason As XceedBackupLib.bkpSkippingReason)